package com.ctf.soft.ms.controls.common;

import com.ctf.soft.ms.dao.model.manage.Area;
import com.ctf.soft.ms.service.common.IAreaService;
import com.ctf.soft.ms.utils.ToolsUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpServletRequest;
import java.util.List;

/**
 * 名称： AreaController<br>
 * 描述： 地区代码控制器<br>
 * 最近修改时间：2015/9/17 10:06<br>
 * 修改说明：
 *
 * @author jiajl
 */
@Controller
@RequestMapping("/area")
public class AreaController {

    @Autowired
    private IAreaService areaService;

    @RequestMapping("/List")
    @ResponseBody
    public List<Area> loadList(HttpServletRequest request) {
        List<Area> list = null;
        try {
            Area params = new Area();
            if (!ToolsUtil.isEmpty(request.getParameter("pid"))) {
                params.setPid(Integer.valueOf(request.getParameter("pid").toString().trim()));
            }
            list = areaService.selectByList(params);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return list;
    }
}
